package com.asura.ops.sync.client;

import com.asura.ops.sync.client.entity.*;
import com.asura.ops.sync.sdk.handle.JdbcTemplateAbstractSyncHandler;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;


@Slf4j
@Component
public class IBSSyncHandler extends JdbcTemplateAbstractSyncHandler<Object> {
    @Resource
    private DataSourceConfig dataSourceConfig;

    @PostConstruct
    public void init() {
        Map<String, Class> maps = Maps.newConcurrentMap();
        maps.put("mdm_annex", MdmAnnexEntity.class);
        maps.put("mdm_carrier", MdmCarrierEntity.class);
        maps.put("mdm_carrier_product", MdmCarrierProductEntity.class);
        maps.put("mdm_dict", MdmDictEntity.class);
        maps.put("mdm_lot_property_define", MdmLotPropertyDefineEntity.class);
        maps.put("mdm_lot_property_group", MdmLotPropertyGroupEntity.class);
        maps.put("mdm_lpn_type", MdmLpnTypeEntity.class);
        maps.put("mdm_meta_city", MdmMetaCityEntity.class);
        maps.put("mdm_meta_province", MdmMetaProvinceEntity.class);
        maps.put("mdm_meta_region", MdmMetaRegionEntity.class);
        maps.put("mdm_meta_town", MdmMetaTownEntity.class);
        maps.put("mdm_owner", MdmOwnerEntity.class);
        maps.put("mdm_owner_sku", MdmOwnerSkuEntity.class);
        maps.put("mdm_route", MdmRouteEntity.class);
        maps.put("mdm_sign", MdmSignEntity.class);
        maps.put("mdm_sku_brand", MdmSkuBrandEntity.class);
        maps.put("mdm_sku_category", MdmSkuCategoryEntity.class);
        maps.put("mdm_sku_component", MdmSkuComponentEntity.class);  //
        maps.put("mdm_sku", MdmSkuEntity.class);
        maps.put("mdm_sku_extend", MdmSkuExtendEntity.class); //
        maps.put("mdm_sku_lot_property", MdmSkuLotPropertyEntity.class);
        maps.put("mdm_sku_packing_define", MdmSkuPackingDefineEntity.class);
        maps.put("mdm_store", MdmStoreEntity.class);
        maps.put("mdm_supplier", MdmSupplierEntity.class);
        maps.put("mdm_truck_type", MdmTruckTypeEntity.class);
        maps.put("mdm_warehouse", MdmWarehouseEntity.class);
        maps.put("mdm_warehouse_lot_property", MdmWarehouseLotPropertyEntity.class);

        this.configTableEntityClassMap(maps);


        this.configDatasourceList(dataSourceConfig.dataSourceList());
    }
}
